﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Carto;

namespace ComponentGIS.Command
{
    class ExtentForwardCommand:ICommand
    {
        #region 字段
        private IHookHelper hookHelper;
        private IExtentStack extentStack;
        private bool enabled = true;
        #endregion

        #region ICommand成员
        public int Bitmap
        {
            get { return -1; }
        }

        public string Caption
        {
            get { return "前一视图"; }
        }

        public string Category
        {
            get { return "地图浏览"; }
        }

        public bool Checked
        {
            get { return false; }
        }

        public bool Enabled
        {
            get { return enabled; }
        }

        public int HelpContextID
        {
            get { return -1; }
        }

        public string HelpFile
        {
            get { return string.Empty; }
        }

        public string Message
        {
            get { return "前一视图"; }
        }

        public string Name
        {
            get { return "ExtentForwardCommand"; }
        }

        public void OnClick()
        {
            if (extentStack.CanRedo())
                extentStack.Redo();
            else
                enabled = false;
        }

        public void OnCreate(object Hook)
        {
            hookHelper = new HookHelperClass();
            hookHelper.Hook = Hook;
            extentStack = hookHelper.ActiveView.ExtentStack;
            if (hookHelper.ActiveView == null)
                hookHelper = null;
        }

        public string Tooltip
        {
            get { return "后一视图"; }
        }
        #endregion
    }
}
